package com.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.domain.ClubMemberDO;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 社团成员信息管理 Mapper 接口
 * </p>
 * @author 34448
 */
@Mapper
public interface ClubMemberMapper extends BaseMapper<ClubMemberDO> {

    @Select("SELECT YEAR(create_time) AS year, COUNT(*) AS count FROM club_members WHERE YEAR(create_time) = #{year} GROUP BY YEAR(create_time)")
    List<Map<String, Object>> countClubMembersByYear(@Param("year") Integer year);

    @Select("SELECT YEAR(create_time) AS year, COUNT(*) AS count FROM club_members GROUP BY YEAR(create_time)")
    List<Map<String, Object>> countClubMembersAllYears();
}